<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
<!--
	Tomato GUI
	Copyright (C) 2006-2008 Jonathan Zarate
	http://www.polarcloud.com/tomato/
	For use with Tomato Firmware only.
	No part of this file may be used without permission.
-->
<html>
<head>
<meta http-equiv='content-type' content='text/html;charset=utf-8'>
<meta name='robots' content='noindex,nofollow'>
<title>[<% ident(); %>] 带宽监控：每日流量</title>
<link rel='stylesheet' type='text/css' href='tomato.css'>
<link rel='stylesheet' type='text/css' href='<% nv('web_css'); %>.css'>
<script type='text/javascript' src='tomato.js'></script>
<script type='text/javascript' src='bwm-hist.js'></script>
<script type='text/javascript'>
//	<% nvram("wan_ifname,lan_ifname,rstats_enable"); %>
try {
//	<% bandwidth("daily"); %>
}
catch (ex) {
 daily_history = [];
}
rstats_busy = 0;
if (typeof(daily_history) == 'undefined') {
 daily_history = [];
 rstats_busy = 1;
}
function save()
{
 cookie.set('daily', scale, 14);
}
function redraw()
{
 var h;
 var grid;
 var rows;
 var yr, mo, da;
 
 rows = 0;
 block = '';
 gn = 0;
 grid = '<table class="bwmg" cellspacing="1">';
 grid += makeRow('header', '日期', '下载', '上传', '合计');
 
 for (i = 0; i < daily_history.length; ++i) {
 h = daily_history[i];
 yr = (((h[0] >> 16) & 0xFF) + 1900);
 mo = ((h[0] >>> 8) & 0xFF);
 da = (h[0] & 0xFF);
 grid += makeRow(((rows & 1) ? 'odd' : 'even'), yr + ' 年 ' + months[mo] + ' ' + da + ' 日', rescale(h[1]), rescale(h[2]), rescale(h[1] + h[2]));
 ++rows;
 }
 E('bwm-daily-grid').innerHTML = grid + '</table>';
}
function init()
{
 var s;
 if (nvram.rstats_enable != '1') return;
 if ((s = cookie.get('daily')) != null) {
 if (s.match(/^([0-2])$/)) {
 E('scale').value = scale = RegExp.$1 * 1;
 }
 }
 daily_history.sort(cmpHist);
 redraw();
}
</script>
</head>
<body onload='init()'>
<form>
<table id='container' cellspacing=0>
<tr><td colspan=2 id='header'>
 <div class='title'>Tomato</div>
 <div class='version'>简体中文版 <% version(); %></div>
</td></tr>
<tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
<td id='content'>
<div id='ident'><% ident(); %></div>
<div class='section-title'>WAN 每日流量</div>
<div id='bwm-daily-grid' style='float:left'></div>
<div style="float:right;text-align:right">
<b>单位切换</b> <select onchange='changeScale(this)' id='scale'><option value=0>KB</option><option value=1>MB</option><option value=2 selected>GB</option></select><br>
<br>
&raquo; <a href="admin-bwm.asp">设置</a>
<br><br><br>
</div>
<br>
<script type='text/javascript'>checkRstats();</script>
</td></tr>
<tr><td id='footer' colspan=2>
<input type='button' value='重新整理' onclick='reloadPage()'>
</td></tr>
</table>
</form>
</body>
</html>
